package top.lyjwn.todo.weinxin.bjnews;

import com.alibaba.fastjson2.JSONException;
import com.alibaba.fastjson2.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import top.lyjwn.todo.weinxin.data.bjnews.WXBUser;

/**
 * 微信公众号基础AccessToken
 * 
 * @author luoyujie
 *
 */
public class BjnewsAccessToken {

	private static final Logger log = LoggerFactory.getLogger("error");

	/**
	 * 获取到的凭证
	 */
	private String access_token;

	/**
	 * 凭证有效时间，单位：秒，注：将会被换算成毫秒存入这个变量
	 */
	private long expires_in;
	/**
	 * 过期时间
	 */
	private long expires_time;

	public BjnewsAccessToken() {
	}

	public BjnewsAccessToken(String access_token, long expires_in, long expires_time) {
		this.access_token = access_token;
		this.expires_in = expires_in;
		this.expires_time = expires_time;
	}


	public static BjnewsAccessToken builder(JSONObject jsonObject) {
		try {
			return jsonObject.toJavaObject(BjnewsAccessToken.class);
		} catch (JSONException e) {
			log.error("BjnewsAccessToken 转换失败", e);
		}
		return null;
	}

	public String getAccess_token() {
		return access_token;
	}

	public void setAccess_token(String access_token) {
		this.access_token = access_token;
	}

	public long getExpires_in() {
		return expires_in;
	}

	public void setExpires_in(long expires_in) {
		this.expires_in = expires_in;
	}

	public long getExpires_time() {
		return expires_time;
	}

	public void setExpires_time(long expires_time) {
		this.expires_time = expires_time;
	}
}
